﻿////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2008-2011 Andreas Huber Doenni</copyright>
// Distributed under the Microsoft Public License (Ms-PL).
// See accompanying file License.txt or copy at http://mews.codeplex.com/license.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Mews.Application
{
    using System;
    using System.Diagnostics.CodeAnalysis;

    using Mews.Application.Properties;
    using Mews.Net.Nntp.Cache;

    [SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1601:PartialElementsMustBeDocumented", Justification = "Another part already documents the class.")]
    internal partial class MainForm
    {
        /// <summary>Implements the controller for no document.</summary>
        private sealed class NullController : IController
        {
            private readonly MainForm mainForm;

            ////////////////////////////////////////////////////////////////////////////////////////////////////////////

            /// <summary>See <see cref="IController.Document"/>.</summary>
            public object Document
            {
                get { return null; }
            }

            /// <summary>See <see cref="IController.UpdateCount"/>.</summary>
            public void UpdateCount()
            {
            }

            /// <summary>See <see cref="IController.Update"/>.</summary>
            public void Update()
            {
                this.mainForm.treeView.Nodes.Clear();
                this.mainForm.statusTextBox.Text = Resources.GroupStatusNone;
            }

            /// <summary>See <see cref="IDisposable.Dispose"/>.</summary>
            public void Dispose()
            {
            }

            ////////////////////////////////////////////////////////////////////////////////////////////////////////////

            internal NullController(MainForm mainForm)
            {
                this.mainForm = mainForm;

                this.mainForm.quickMenuItem.Text = null;
                this.mainForm.quickMenuItem.Enabled = false;

                this.mainForm.sendReceiveMinimalGroupMenuItem.Enabled = false;
                this.mainForm.sendReceiveMinimalHostMenuItem.Enabled = false;
                this.mainForm.sendReceiveFullGroupMenuItem.Enabled = false;
                this.mainForm.sendReceiveFullHostMenuItem.Enabled = false;
                this.mainForm.filterMenuItem.Enabled = false;
                this.mainForm.markGroupAsReadMenuItem.Enabled = false;
                this.mainForm.newMenuItem.Enabled = false;
            }
        }
    }
}
